print('请依次输入(时段默认每7天一个时段)')
print('无值则输入0')
def mxq(a1,a2,a3,needTime,planTime,intNum):
    for i in range(intNum):
        if i+1 <= needTime:
            a3.append(a2[i])
        elif needTime < i+1 <= planTime:
            a3.append(max(a1[i],a2[i]))
        else:
            a3.append(a1[i])
    return a3
def ass(a1,a2):
    for i in range(int(len(a1)-1)):
        a2.append(a1[i])
    return a2
print()
nowStock = int(input("可用/当期库存："))
safeStock = int(input("安全库存："))
batch = int(input("批量："))
jhJsl = int(input('是(1)否(0)有计划接收量？'))
if jhJsl==1:
    jhjs = input('请依次输入预测量，空格隔开\n')
    jhjsl = ['计划接收量']
elif jhJsl==0:
    print('哈哈哈哈哈，下一项')
needTime = int(input("需求时界："))
planTime = int(input("计划时界："))
advTime = int(input("提前期/天："))
intNum = int(input("总时段数："))
yclarr = input('请依次输入预测量，空格隔开\n')
xqlarr = input('请依次输入订单量，空格隔开\n')

ycl = ['预测量']
ddl = ['订单量']
mxql = ['毛需求量']

yjkcq = ['预计库存(前)']
yjkch = ['预计库存(后)']
jxql = ['净需求量']
jhccl = ['计划产出量']
jhtrl = ['计划投入量']
kgxsl = ['可供销售量']

y = list(map(int,yclarr.split()))
x = list(map(int,xqlarr.split()))

ass(y,ycl)
ass(x,ddl)
mxq(y,x,mxql,needTime,planTime,intNum)

for i in range(intNum):
    if jhJsl==0:
        if i+1 == 1:
            yjkcq.append(nowStock - mxql[1])
            if yjkcq[1] > safeStock:
                yjkch.append(yjkcq[1])
                kgxsl.append(mxql[1])
                jxql.append(0)
                jhccl.append(0)
            else:
                print("需要增加当期投入量")
        if i+1 > 1:
            yjkcq.append(yjkch[i] - mxql[i+1])
            if yjkcq[i+1] >= safeStock:
                yjkch.append(yjkcq[i+1])
                jhtrl.append(0)
                jhccl.append(0)
                kgxsl.append(0)
                jxql.append(0)
            elif yjkcq[i+1] < safeStock:
                yjkch.append(yjkcq[i+1] + batch)
                jhccl.append(batch)
                jhtrl.append(batch)
                jxql.append(safeStock-yjkcq[i+1])
        if i+1 == intNum:
            jhtrl.append(0)

print(ycl)
print()
print(ddl)
print()
print(mxql)
print()
print(yjkcq)
print()
print(yjkch)
print()
print(jxql)
print()
print(jhccl)
print()
print(jhtrl)
print()





    
